<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<style>
    *{
    text-align: center;
  }

  div{
    width: 500px;
    height: 500px;
    margin: 0 auto;
    border: 5px solid red;
    border-radius:50% ;
    
    line-height: 500px;
    font-size: 300px;
    font-weight: 900;
  }
</style>
<body>
    定时器
    <div>
        5
    </div>


    <script>
        
        let func = ()=>{
            let num = document.querySelector('div').innerHTML;
            num--;
            if(num <= 0){
                clearInterval(timer);
                location.href = 'https://www.jd.com'
            }else{
                document.querySelector('div').innerHTML = num;
            }
        }
       let timer = setInterval(func,1000);

    </script>
</body>
</html>